<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommodityActivityStatisticsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('commodity_activity_statistics', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('commodity_id')->index('commodity_id')->comment('商品 ID');
            $table->unsignedBigInteger('commodity_activity_id')->index('commodity_activity_id')->comment('商品活动 ID');

            $table->unsignedInteger('number_of_cultivation_awards')->default(0)->comment('培养奖数量');
            $table->unsignedBigInteger('total_amount_of_cultivation_awards')->default(0)->comment('培养奖总金额 单位分');

            $table->unsignedBigInteger('total_amount_of_after_sale_compensation')->default(0)->comment('售后(订单)补偿总金额');
            $table->unsignedBigInteger('total_amount_of_after_sale_compensation_for_shipping_return')->default(0)->comment('售后(退货运费)补偿总金额');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('commodity_activity_statistics');
    }
}
